-- reduce_negative
-- create by panyl
-- 减弱某类效果

return {
    apply = function(prop, baseValue)
        if prop[3] == 0 then
            return baseValue;
        end

        -- 减少
        return baseValue - math.modf(baseValue * prop[3] / 1000);
    end,

    desc = function(prop)
        local data = PropM.query(prop[1], "desc");
        local normal = data.normal;
        local immunity = data.immunity;
        local desc = normal;
        if prop[3] >= 1000 then
            desc = immunity;
        end

        local propName;

        if type(prop[2]) == "string" then
            propName = FieldsM.getFieldName(prop[2]);
        elseif type(prop[2]) == "number" then
            propName = FieldsM.getFieldName(PropM.query(prop[2], "rule"));
        end

        local str = string.gsub(desc, "{1}", prop[3] / 10);

        return string.gsub(str, "{0}", propName);
    end,

    record = function(target, prop, path)
        return false;
    end
};
